fix(hooks): hooks double patching#7601
Merged
pabloerhard merged 5 commits intomasterfrom Feb 24, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7601 +/- ##
==========================================
- Coverage 80.31% 80.30% -0.02%
==========================================
Files 733 733
Lines 31547 31565 +18
==========================================
+ Hits 25337 25347 +10
- Misses 6210 6218 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Overall package sizeSelf size: 4.78 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 816.75 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
This comment has been minimized.
This comment has been minimized.
rochdev
approved these changes
Feb 24, 2026
dd-octo-sts bot
pushed a commit
that referenced
this pull request
Feb 25, 2026
* fix hooks double patching * Prevent fix on builtin modules * testing with out weakmap * fix hook cache logic * fix onrequire wrapping
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR fixes an issue where double patching was happening. This happened in the following example
import someModule from 'someModule'
import anotherModule form 'anotherModule'
then anotherModule does -> require('someModule')
Causing both the ESM and CJS loader to trigger the same hook, the existing caching logic was not able to detect this scenario.
Motivation
Additional Notes